#pragma once

#include <opencv2\opencv.hpp>

using namespace cv;

class SupportVectorMachine
{
private:
	CvSVM svm;
	CvSVMParams params;

public:
	void set_trainer(CvSVM _svm)
	{
		svm = _svm;
	}

	void set_params(CvSVMParams _params)
	{
		params = _params;
	}

	CvSVM get_trainer()
	{
		return svm;
	}

	CvSVMParams get_params()
	{
		return params;
	}

	void train_auto(const Mat& data, const Mat& label, CvSVMParams _params, int k)
	{
		params = _params;
		svm.train_auto(data, label, Mat(), Mat(), params, k);
	}

	void train(const Mat& data, const Mat& label, CvSVMParams _params)
	{
		svm.train(data, label, Mat(), Mat(), _params);
	}

	float predict(const Mat& sample)
	{
		return svm.predict(sample);
	}
};